/*
 * Copyright (c) 2013 iTAC Software AG, Germany. All Rights Reserved.
 * 
 * This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
 * printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
 * without the written permission of iTAC Software AG.
 */
package org.template.portal;

import javax.persistence.Embeddable;
import javax.persistence.ManyToOne;

// TODO
/**
 * @author rafal.kojta
 */
@Embeddable
public class StudentGroupId implements java.io.Serializable {

  @ManyToOne
  private Student student;

  @ManyToOne
  private YearGroup yearGroup;

  public Student getStudent() {
    return student;
  }

  public void setStudent(Student student) {
    this.student = student;
  }

  public YearGroup getYearGroup() {
    return yearGroup;
  }

  public void setYearGroup(YearGroup group) {
    this.yearGroup = group;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o)
      return true;
    if (o == null || getClass() != o.getClass())
      return false;

    StudentGroupId that = (StudentGroupId) o;

    if (student != null ? !student.equals(that.student) : that.student != null)
      return false;
    if (yearGroup != null ? !yearGroup.equals(that.yearGroup) : that.yearGroup != null)
      return false;

    return true;
  }

  @Override
  public int hashCode() {
    int result;
    result = (student != null ? student.hashCode() : 0);
    result = 31 * result + (yearGroup != null ? yearGroup.hashCode() : 0);
    return result;
  }

}
